package com.springcloud.feignconsumer.service;

import com.springcloud.feignconsumer.entity.User;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * 定义helloservice接口的服务降级类
 * @author AL
 */
@Component
public class HelloServiceFallback implements HelloService {

    @Override
    public User hello(String username) {
        return new User("未知",0);
    }

//    @Override
//    public String hello(@RequestParam("name") String name) {
//        return "error";
//    }

    @Override
    public User hello(@RequestHeader("name") String name, @RequestHeader("age") Integer age) {
        return new User("未知",0);
    }

    @Override
    public String hello(@RequestBody User user) {
        return "error";
    }
}
